﻿/*********************************************************************************
**                                                                              **
**  Copyright (C) 2024 LiLong                                                   **
**  This file is part of GnssLogs.                                              **
**                                                                              **
**  GnssLogs is free software: you can redistribute it and/or modify            **
**  it under the terms of the GNU Lesser General Public License as published by **
**  the Free Software Foundation, either version 3 of the License, or           **
**  (at your option) any later version.                                         **
**                                                                              **
**  GnssLogs is distributed in the hope that it will be useful,                 **
**  but WITHOUT ANY WARRANTY; without even the implied warranty of              **
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               **
**  GNU Lesser General Public License for more details.                         **
**                                                                              **
**  You should have received a copy of the GNU Lesser General Public License    **
**  along with GnssLogs.  If not, see <https://www.gnu.org/licenses/>.          **
**********************************************************************************/
#include <GnssLogs/GnssLogs.h>

#include <gtest/gtest.h>

#include <print>

inline void printSplit() { std::print("-----------------------------------------------------------------\n"); }

TEST(GPGSTTest, bool)
{
    std::vector<std::string> datas { { "$GPGST,203017.00,1.25,0.02,0.01,-16.7566,0.02,0.01,0.03*7D\r\n" },
                                     { "$GNGST,205246.00,1.19,0.02,0.01,-2.4501,0.02,0.01,0.03*5B\r\n" },
                                     { "$GPGST,000457.01,,,,,,,*7E\r\n" },
                                     { "$GPGST,,,,,,,,*57\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GST::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPGSVTest, bool)
{
    std::vector<std::string> datas { { "$GPGSV,4,1,16,02,82,150,53,11,78,139,,12,72,191,53,25,50,296,51*77\r\n" },
                                     { "$GPGSV,4,2,16,06,43,056,49,20,33,149,45,29,20,275,44,19,16,087,46*73\r\n" },
                                     { "$GPGSV,4,3,16,31,11,329,42,05,10,169,42,24,07,212,44,04,01,033,*7C\r\n" },
                                     { "$GPGSV,4,4,16,44,32,184,47,51,31,171,48,48,31,194,47,46,30,199,47*7E\r\n" },
                                     { "$GLGSV,3,1,10,81,63,034,51,82,53,272,51,80,52,292,,79,38,200,49*6A\r\n" },
                                     { "$GLGSV,3,2,10,65,24,046,42,66,16,105,47,73,15,334,46,88,14,062,46*61\r\n" },
                                     { "$GLGSV,3,3,10,83,11,253,,72,07,001,44*68\r\n" },
                                     { "$GPGSV,4,1,16,02,80,085,53,11,76,091,,12,61,180,51,25,58,284,52*79\r\n" },
                                     { "$GPGSV,4,2,16,20,42,142,50,06,33,056,47,29,28,280,47,05,19,166,47*7F\r\n" },
                                     { "$GPGSV,4,3,16,31,15,321,46,19,08,093,46,04,04,025,,09,03,055,*78\r\n" },
                                     { "$GPGSV,4,4,16,44,32,184,48,51,31,171,48,48,31,194,47,46,30,199,48*7E\r\n" },
                                     { "$GAGSV,3,1,09,34,72,231,53,30,65,251,53,36,51,059,51,02,36,170,49*62\r\n" },
                                     { "$GAGSV,3,2,09,27,25,314,47,15,19,236,47,04,08,037,46,09,04,085,*65\r\n" },
                                     { "$GAGSV,3,3,09,11,03,057,*50\r\n" },
                                     { "$GQGSV,1,1,01,02,08,309,37*4D\r\n" },
                                     { "$BDGSV,5,1,18,34,85,015,53,11,67,274,51,12,55,069,49,43,39,265,50*61\r\n" },
                                     { "$BDGSV,5,2,18,23,37,289,50,25,36,225,48,44,31,078,49,22,25,064,46*69\r\n" },
                                     { "$BDGSV,5,3,18,21,20,119,45,16,11,320,42,06,10,325,40,09,10,340,38*6D\r\n" },
                                     { "$BDGSV,5,4,18,39,08,310,40,37,07,331,45,59,06,288,,19,05,017,*64\r\n" },
                                     { "$BDGSV,5,5,18,31,03,333,,24,02,179,*68\r\n" },
                                     { "$GIGSV,1,1,00,,,,*60\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GSV::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPGRSTest, bool)
{
    std::vector<std::string> datas { { "$GPGRS,202812.00,1,0.5,0.1,-0.0,-0.0,-0.2,0.8,0.4,-0.3,-0.6,-0.0,,*4A\r\n" },
                                     { "$GNGRS,174837.00,1,-0.1,0.7,-0.2,0.1,0.3,0.5,-0.7,-0.5,-0.3,0.3,,*72\r\n " },
                                     { "$GNGRS,174837.00,1,2.5,-1.3,-0.4,-0.5,2.8,-2.1,-3.3,,,,,*50\r\n " },
                                     { "$GNGRS,174837.00,1,-0.3,-0.1,-0.3,-0.5,0.8,-0.3,0.4,0.5,,,,*7D\r\n " },
                                     { "$GNGRS,174837.00,1,0.2,-0.3,0.1,0.1,-1.3,0.1,0.0,0.3,,,,*5F\r\n " } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GRS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPGSATest, bool)
{
    std::vector<std::string> datas { { "$GPGSA,M,3,05,02,31,06,19,29,20,12,24,25,,,0.9,0.5,0.7*35\r\n" },
                                     { "$GNGSA,M,3,03,14,17,06,12,19,02,01,24,32,,,0.8,0.5,0.6*22\r\n" },
                                     { "$GNGSA,M,3,66,85,75,67,73,84,83,,,,,,0.8,0.5,0.6*26\r\n" },
                                     { "$GNGSA,M,3,12,11,33,31,03,24,25,08,,,,,0.8,0.5,0.6*20\r\n" },
                                     { "$GNGSA,M,3,28,46,36,27,39,23,43,37,,,,,0.8,0.5,0.6*2B\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GSA::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(RANGETest, bool)
{
    std::vector<std::string> datas {
        { "#RANGEA,USB2,0,66.5,FINESTEERING,2310,184505.000,02000800,5103,17139;62,2,0,21053896.972,0.082,-110638974.709793,0.005,-840.539,"
          "52.0,138.129,0810dc24,2,0,21053900.017,0.073,-86212200.784217,0.005,-654.968,45.7,111.249,01305c2b,21,0,21448566.091,0.106,-"
          "112712973.861139,0.006,-2155.269,49.8,137.387,0810dd24,21,0,21448570.514,0.151,-87828306.052304,0.008,-1679.434,39.3,111.247,"
          "01305d2b,8,0,23445668.531,0.145,-123207817.016607,0.009,-2891.357,47.1,137.360,1810dd44,8,0,23445683.236,0.081,-96006114.728523,"
          "0.009,-2253.015,44.7,111.000,11305d4b,8,0,23445678.619,0.397,-96006119.963443,0.009,-2253.015,38.3,73.522,0230dd4b,8,0,23445682."
          "958,0.048,-92005879.798737,0.007,-2159.207,45.5,115.640,01d0dd44,14,0,21749108.516,0.387,-114292340.043839,0.017,2036.463,38.6,"
          "137.246,0810ddc4,14,0,21749112.307,0.207,-89058989.469638,0.025,1586.857,36.6,112.746,01305dcb,14,0,21749113.990,0.448,-"
          "89058993.685625,0.019,1586.854,37.3,114.506,0230ddcb,14,0,21749119.528,0.068,-85348211.960308,0.008,1520.774,42.5,116.046,"
          "01d0ddc4,195,0,38867885.363,0.485,-204252106.269070,0.020,-545.884,36.7,75.988,1815de04,195,0,38867893.772,0.237,-159157514."
          "403877,0.021,-425.363,42.9,72.609,0235de0b,195,0,38867896.787,0.069,-152525960.140570,0.008,-407.764,42.4,74.049,01d5de04,194,0,"
          "39158895.295,0.201,-205781380.453785,0.010,787.738,44.3,77.767,1815de24,194,0,39158901.876,0.196,-160349151.035400,0.010,613."
          "819,44.5,74.388,0235de2b,194,0,39158905.385,0.042,-153667953.411940,0.006,588.257,46.7,75.828,01d5de24,50,5,19651435.955,0.300,-"
          "104937550.880436,0.021,-321.014,36.3,90.573,18119f24,50,5,19651441.063,0.075,-81618129.701834,0.022,-249.681,34.5,88.533,"
          "00b13f2b,50,5,19651440.750,0.489,-81618122.467533,0.021,-249.680,32.2,87.574,00319f2b,60,10,20166466.474,0.079,-107876995."
          "055378,0.006,-2599.205,47.8,91.471,08019f44,51,0,21228514.249,0.098,-113159920.869501,0.007,3096.777,46.0,91.527,18119f64,51,0,"
          "21228526.180,0.040,-88013315.263533,0.008,2408.606,40.1,89.328,00b13f6b,51,0,21228525.880,0.181,-88013306.031046,0.008,2408.606,"
          "40.7,90.248,10319f6b,34,0,23769164.540,0.132,-124907805.016487,0.008,1056.874,47.0,55.279,0853dce4,34,0,23769175.426,0.066,-"
          "93275347.303521,0.008,789.134,42.7,52.960,0193dce4,34,0,23769173.065,0.048,-95708598.855568,0.008,809.777,45.5,53.039,0233dce4,"
          "34,0,23769173.814,0.019,-94491975.709353,0.008,799.450,44.9,51.300,02933ce4,2,0,24598875.712,0.112,-129267965.010218,0.007,-811."
          "414,48.4,55.316,0853dd04,2,0,24598885.887,0.064,-96531303.488398,0.008,-605.965,43.0,53.037,0193dd04,2,0,24598883.312,0.060,-"
          "99049496.223502,0.008,-621.797,43.6,53.037,0233dd04,2,0,24598884.651,0.020,-97790407.983817,0.008,-613.856,44.1,51.296,02933d04,"
          "36,0,25567326.588,0.105,-134357208.976818,0.007,-1690.772,49.0,57.173,0853dd44,36,0,25567338.240,0.062,-100331717.308840,0.009,-"
          "1262.596,43.2,54.833,0193dd44,36,0,25567335.316,0.049,-102949060.280762,0.008,-1295.629,45.3,54.833,0233dd44,36,0,25567336.430,"
          "0.018,-101640391.424719,0.008,-1279.039,45.0,53.115,02933d44,35,0,22903754.268,0.021,-119265857.057749,0.005,-2228.793,51.9,132."
          "440,18149ec4,35,0,22903762.868,0.076,-89879283.044501,0.009,-1679.544,41.6,112.242,0134dec4,35,0,22903760.295,0.031,-92223934."
          "969441,0.012,-1723.377,40.9,60.502,01743ec4,44,0,21418702.874,0.082,-111532841.157459,0.013,228.291,41.2,95.987,08149f04,44,0,"
          "21418706.576,0.121,-84051598.599390,0.014,171.992,37.4,89.788,0134df04,44,0,21418702.230,0.125,-86244241.196747,0.035,176.477,"
          "35.2,14.167,01743704,7,0,36458417.403,0.045,-189848548.152029,0.009,-109.973,45.1,133.857,08149f84,7,0,36458419.169,0.106,-"
          "146802941.266795,0.007,-85.238,46.8,116.657,1034df84,10,0,36615721.821,0.038,-190667671.665073,0.008,-12.892,46.5,136.097,"
          "08149fe4,10,0,36615725.915,0.148,-147436351.568377,0.011,-10.115,43.9,117.057,1034dfe4,57,0,20124927.109,0.040,-104795777."
          "603003,0.008,-1311.804,46.4,126.332,18049c04,59,0,38127085.342,0.064,-198537733.911512,0.013,13.205,42.4,121.226,18949d64,59,0,"
          "38127081.437,0.032,-153521957.537409,0.015,10.034,37.8,116.051,11743d64,24,0,21846420.315,0.023,-113760046.515230,0.006,1501."
          "111,51.0,136.746,08149da4,24,0,21846425.230,0.041,-85730061.817463,0.005,1131.132,46.9,111.786,0134dda4,24,0,21846422.685,0.015,"
          "-87966487.208760,0.008,1160.725,44.3,116.244,11743da4,4,0,39577591.965,0.138,-206090907.014069,0.024,35.622,36.8,1.735,08849dc4,"
          "26,0,22214453.729,0.049,-115676494.405846,0.011,-1309.747,44.3,134.205,18149de4,26,0,22214462.434,0.090,-87174318.766137,0.011,-"
          "987.015,40.0,112.245,0134dde4,26,0,22214459.037,0.024,-89448413.413430,0.013,-1012.801,40.1,116.043,11743de4,40,0,36569028.033,"
          "0.042,-190424526.924927,0.008,-312.547,45.8,130.477,18149e04,40,0,36569034.073,0.057,-143504744.899451,0.006,-235.635,43.9,111."
          "837,0134de04,40,0,36569031.814,0.019,-147248334.960366,0.010,-241.805,42.4,116.257,11743e04,62,0,39381511.980,0.094,-205069867."
          "292986,0.016,-25.360,40.0,98.589,18949e44,62,0,39381513.238,0.015,-158573029.336607,0.007,-19.591,45.0,96.246,01743e44*"
          "5541a51e\r\n" },
        { "#RANGEA,USB2,0,55.5,FINESTEERING,2310,184510.000,02000000,5103,17139;61,2,0,21054698.240,0.076,-110643185.354074,0.005,-843.385,"
          "52.7,143.129,0810dc24,2,0,21054701.315,0.077,-86215481.794929,0.005,-657.185,44.9,116.249,01305c2b,21,0,21450618.108,0.096,-"
          "112723757.049801,0.005,-2157.598,50.7,142.387,0810dd24,21,0,21450622.383,0.175,-87836708.529667,0.008,-1681.248,37.8,116.247,"
          "01305d2b,8,0,23448419.800,0.133,-123222274.684206,0.008,-2891.086,47.8,142.360,1810dd44,8,0,23448434.524,0.080,-96017380.386413,"
          "0.009,-2252.805,44.7,116.000,11305d4b,8,0,23448429.890,0.413,-96017385.626630,0.009,-2252.804,38.0,78.522,0230dd4b,8,0,23448434."
          "219,0.045,-92016676.045727,0.006,-2158.986,46.0,120.640,01d0dd44,14,0,21747171.161,0.365,-114282159.043261,0.019,2036.356,39.1,"
          "142.246,0810ddc4,14,0,21747174.925,0.227,-89051056.203265,0.026,1586.769,35.5,117.746,01305dcb,14,0,21747176.726,0.460,-"
          "89051060.430820,0.020,1586.769,37.1,119.506,0230ddcb,14,0,21747182.130,0.063,-85340609.262904,0.008,1520.623,43.2,121.046,"
          "01d0ddc4,195,0,38868404.857,0.470,-204254836.691160,0.021,-545.649,36.9,80.988,1815de04,195,0,38868413.510,0.234,-159159642."
          "006614,0.022,-425.182,43.0,77.609,0235de0b,195,0,38868416.381,0.063,-152527999.086869,0.008,-407.636,43.2,79.049,01d5de04,194,0,"
          "39158145.595,0.193,-205777440.885441,0.011,788.279,44.6,82.767,1815de24,194,0,39158152.161,0.196,-160346081.236093,0.012,614."
          "242,44.5,79.388,0235de2b,194,0,39158155.731,0.039,-153665011.513245,0.006,588.736,47.4,80.828,01d5de24,50,5,19651737.464,0.314,-"
          "104939161.382973,0.022,-323.213,35.6,95.573,18119f24,50,5,19651742.855,0.069,-81619382.308105,0.023,-251.390,35.1,93.533,"
          "00b13f2b,50,5,19651742.905,0.479,-81619375.072534,0.023,-251.390,32.1,92.574,00319f2b,60,10,20168897.522,0.081,-107889999."
          "381375,0.007,-2601.981,47.4,96.471,08019f44,51,0,21225610.176,0.097,-113144439.739651,0.008,3096.075,45.8,96.527,18119f64,51,0,"
          "21225621.953,0.039,-88001274.401951,0.008,2408.062,39.9,94.328,00b13f6b,51,0,21225621.651,0.178,-88001265.169118,0.009,2408.062,"
          "40.6,95.248,10319f6b,34,0,23768160.101,0.134,-124902526.881912,0.008,1054.731,46.9,60.279,0853dce4,34,0,23768171.043,0.062,-"
          "93271405.828263,0.008,787.702,43.2,57.960,0193dce4,34,0,23768168.653,0.051,-95704554.563292,0.008,808.210,45.0,58.039,0233dce4,"
          "34,0,23768169.377,0.017,-94487982.825188,0.008,797.902,45.3,56.300,02933ce4,2,0,24599648.208,0.106,-129272024.245409,0.007,-811."
          "862,49.0,60.316,0853dd04,2,0,24599658.386,0.060,-96534334.716271,0.008,-606.328,43.6,58.037,0193dd04,2,0,24599655.749,0.066,-"
          "99052606.525668,0.009,-622.062,42.8,58.037,0233dd04,2,0,24599657.133,0.019,-97793478.749817,0.009,-614.171,44.5,56.296,02933d04,"
          "36,0,25568936.188,0.108,-134365667.567032,0.007,-1692.322,48.8,62.173,0853dd44,36,0,25568947.850,0.058,-100338033.774346,0.008,-"
          "1263.803,43.9,59.833,0193dd44,36,0,25568944.964,0.052,-102955541.517659,0.008,-1296.734,44.7,59.833,0233dd44,36,0,25568946.079,"
          "0.017,-101646790.275004,0.009,-1280.242,45.4,58.115,02933d44,35,0,22905894.964,0.020,-119277004.087322,0.005,-2229.734,52.1,137."
          "440,18149ec4,35,0,22905903.485,0.068,-89887683.461476,0.009,-1680.341,42.5,117.242,0134dec4,35,0,22905901.283,0.031,-92232554."
          "542426,0.012,-1724.026,40.5,65.502,01743ec4,44,0,21418484.606,0.078,-111531706.216797,0.014,226.165,41.4,100.987,08149f04,44,0,"
          "21418488.565,0.115,-84050743.286120,0.015,170.548,37.9,94.788,0134df04,7,0,36458523.145,0.043,-189849098.884537,0.011,-109.696,"
          "45.4,138.857,08149f84,7,0,36458524.927,0.113,-146803367.112629,0.009,-84.864,46.2,121.657,1034df84,10,0,36615734.227,0.037,-"
          "190667736.150427,0.007,-12.549,46.8,141.097,08149fe4,10,0,36615738.321,0.159,-147436401.412827,0.012,-9.607,43.3,122.057,"
          "1034dfe4,57,0,20126187.662,0.038,-104802342.175047,0.008,-1313.656,46.7,131.332,18049c04,59,0,38127072.686,0.061,-198537667."
          "996227,0.013,13.419,42.6,126.226,18949d64,59,0,38127068.814,0.032,-153521906.535117,0.015,10.439,37.4,121.051,11743d64,24,0,"
          "21844979.873,0.022,-113752545.769503,0.005,1499.633,51.4,141.746,08149da4,24,0,21844984.812,0.038,-85724409.210993,0.006,1130."
          "124,47.6,116.786,0134dda4,24,0,21844982.166,0.016,-87960687.151022,0.009,1159.544,43.6,121.244,11743da4,4,0,39577557.888,0.130,-"
          "206090728.806236,0.028,35.303,37.1,3.732,08849dc4,26,0,22215712.276,0.047,-115683048.515165,0.011,-1311.411,44.6,139.205,"
          "18149de4,26,0,22215721.006,0.088,-87179257.957035,0.010,-988.361,40.3,117.245,0134dde4,26,0,22215717.644,0.026,-89453481.461510,"
          "0.013,-1014.006,39.3,121.043,11743de4,40,0,36569328.087,0.041,-190426089.597816,0.008,-312.114,46.0,135.477,18149e04,40,0,"
          "36569334.153,0.052,-143505922.520314,0.007,-235.138,44.8,116.837,0134de04,40,0,36569331.909,0.020,-147249543.306307,0.011,-241."
          "265,41.8,121.257,11743e04,62,0,39381536.411,0.091,-205069994.282068,0.017,-25.043,40.0,103.589,18949e44,62,0,39381537.579,0.016,"
          "-158573127.522620,0.008,-19.446,44.3,101.246,01743e44*b6c78bde\r\n" },
        { "#RANGEA,USB2,0,61.5,FINESTEERING,2310,184515.000,02000000,5103,17139;61,2,0,21055502.427,0.083,-110647411.294254,0.005,-846.896,"
          "51.9,148.129,0810dc24,2,0,21055505.540,0.065,-86218774.729419,0.005,-659.920,46.2,121.249,01305c2b,21,0,21452672.700,0.104,-"
          "112734553.835512,0.005,-2160.845,50.0,147.387,0810dd24,21,0,21452676.844,0.131,-87845121.598288,0.007,-1683.777,40.2,121.247,"
          "01305d2b,8,0,23451170.962,0.139,-123236731.887829,0.008,-2891.524,47.5,147.360,1810dd44,8,0,23451185.742,0.071,-96028645.688294,"
          "0.010,-2253.147,45.4,121.000,11305d4b,8,0,23451181.000,0.393,-96028650.929994,0.009,-2253.147,38.5,83.522,0230dd4b,8,0,23451185."
          "376,0.043,-92027471.943627,0.006,-2159.175,46.4,125.640,01d0dd44,14,0,21745234.113,0.400,-114271980.398668,0.020,2035.421,38.3,"
          "147.246,0810ddc4,14,0,21745238.097,0.186,-89043124.767505,0.028,1586.039,37.1,122.746,01305dcb,14,0,21745239.699,0.414,-"
          "89043129.002929,0.020,1586.039,38.0,124.506,0230ddcb,14,0,21745245.136,0.059,-85333008.312930,0.007,1520.009,43.8,126.046,"
          "01d0ddc4,195,0,38868924.569,0.565,-204257567.757813,0.022,-546.167,35.3,85.988,1815de04,195,0,38868933.156,0.232,-159161770."
          "099685,0.023,-425.586,43.0,82.609,0235de0b,195,0,38868936.085,0.060,-152530038.513682,0.008,-407.977,43.6,84.049,01d5de04,194,0,"
          "39157395.665,0.215,-205773500.015369,0.009,788.131,43.7,87.767,1815de24,194,0,39157402.402,0.187,-160343010.413511,0.009,614."
          "125,44.9,84.388,0235de2b,194,0,39157405.810,0.037,-153662068.643073,0.005,588.611,47.8,85.828,01d5de24,50,5,19652041.908,0.325,-"
          "104940786.653956,0.022,-326.224,35.1,100.573,18119f24,50,5,19652047.306,0.064,-81620646.400129,0.024,-253.731,35.5,98.533,"
          "00b13f2b,50,5,19652047.516,0.474,-81620639.167337,0.023,-253.731,32.0,97.574,00319f2b,60,10,20171331.357,0.079,-107903018."
          "649568,0.006,-2605.498,47.3,101.471,08019f44,51,0,21222706.858,0.094,-113128962.881042,0.007,3094.777,45.9,101.527,18119f64,51,"
          "0,21222718.497,0.039,-87989236.864412,0.008,2407.052,39.8,99.328,00b13f6b,51,0,21222718.194,0.175,-87989227.631935,0.008,2407."
          "052,40.6,100.248,10319f6b,34,0,23767157.864,0.151,-124897260.294207,0.007,1051.966,45.9,65.279,0853dce4,34,0,23767168.838,0.059,"
          "-93267472.976324,0.009,785.625,43.7,62.960,0193dce4,34,0,23767166.437,0.049,-95700519.102204,0.008,806.193,45.3,63.039,0233dce4,"
          "34,0,23767167.130,0.016,-94483998.667632,0.008,795.891,45.7,61.300,02933ce4,2,0,24600421.383,0.115,-129276087.109930,0.006,-813."
          "046,48.2,65.316,0853dd04,2,0,24600431.547,0.056,-96537368.649826,0.008,-607.222,44.1,63.037,0193dd04,2,0,24600428.898,0.067,-"
          "99055719.605889,0.008,-623.014,42.7,63.037,0233dd04,2,0,24600430.325,0.018,-97796552.250775,0.008,-615.029,44.6,61.296,02933d04,"
          "36,0,25570547.612,0.121,-134374135.789978,0.007,-1694.790,47.8,67.173,0853dd44,36,0,25570559.331,0.055,-100344357.413910,0.008,-"
          "1265.453,44.3,64.833,0193dd44,36,0,25570556.449,0.054,-102962030.129992,0.007,-1298.565,44.5,64.833,0233dd44,36,0,25570557.570,"
          "0.016,-101653196.412959,0.008,-1282.050,45.5,63.115,02933d44,35,0,22908036.813,0.020,-119288157.095875,0.005,-2231.335,52.0,142."
          "440,18149ec4,35,0,22908045.225,0.064,-89896088.381150,0.009,-1681.557,43.0,122.242,0134dec4,35,0,22908043.397,0.030,-92241178."
          "742611,0.011,-1725.455,40.6,70.502,01743ec4,44,0,21418268.504,0.080,-111530582.428894,0.013,223.460,41.0,105.987,08149f04,44,0,"
          "21418272.715,0.112,-84049896.389994,0.014,168.453,38.1,99.788,0134df04,7,0,36458628.738,0.045,-189849648.737301,0.008,-110.010,"
          "45.0,143.857,08149f84,7,0,36458630.529,0.112,-146803792.282734,0.008,-85.051,46.3,126.657,1034df84,10,0,36615746.446,0.038,-"
          "190667799.691217,0.007,-12.786,46.5,146.097,08149fe4,10,0,36615750.522,0.158,-147436450.552721,0.011,-9.878,43.3,127.057,"
          "1034dfe4,57,0,20127450.017,0.041,-104808916.165964,0.009,-1315.742,45.9,136.332,18049c04,59,0,38127060.004,0.061,-198537601."
          "984186,0.012,13.208,42.4,131.226,18949d64,59,0,38127056.179,0.032,-153521855.494328,0.014,10.130,37.3,126.051,11743d64,24,0,"
          "21843540.996,0.023,-113745053.157051,0.005,1497.510,51.0,146.746,08149da4,24,0,21843545.946,0.037,-85718762.732487,0.005,1128."
          "606,47.9,121.786,0134dda4,24,0,21843543.197,0.016,-87954893.373909,0.009,1158.010,43.4,126.244,11743da4,4,0,39577523.811,0.128,-"
          "206090551.519653,0.024,35.460,37.0,8.732,08849dc4,26,0,22216972.803,0.050,-115689612.869385,0.009,-1313.918,44.2,144.205,"
          "18149de4,26,0,22216981.544,0.087,-87184204.850783,0.011,-990.263,40.3,122.245,0134dde4,26,0,22216978.219,0.026,-89458557.413468,"
          "0.014,-1016.007,39.1,126.043,11743de4,40,0,36569627.919,0.043,-190427650.987349,0.009,-312.487,45.3,140.477,18149e04,40,0,"
          "36569633.987,0.049,-143507099.176937,0.006,-235.269,45.3,121.837,0134de04,40,0,36569631.748,0.019,-147250750.659373,0.009,-241."
          "489,41.7,126.257,11743e04,62,0,39381560.847,0.086,-205070121.355057,0.015,-25.427,40.3,108.589,18949e44,62,0,39381561.947,0.016,"
          "-158573225.765046,0.007,-19.816,44.4,106.246,01743e44*250f5b4d\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::RANGE::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPGGATest, bool)
{
    std::vector<std::string> datas { { "$GPGGA,202530.00,5109.0262,N,11401.8407,W,5,40,0.5,1097.36,M,-17.00,M,18,TSTR*61\r\n" },
                                     { "$GPGGA,134658.00,5106.9792,N,11402.3003,W,2,09,1.0,1048.47,M,-16.27,M,08,AAAA*60\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GGA::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPALMTest, bool)
{
    std::vector<std::string> datas { { "$GPALM,30,01,01,2210,00,617b,0f,1da7,fd70,a10d0a,24de91,6fe696,16263f,17c,ffe*7B\r\n" },
                                     { "$GPALM,30,02,02,2210,00,a752,0f,0f5f,fd56,a10cf7,c62dda,6c306a,1c751c,d53,000*7F\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::ALM::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPGLLTest, bool)
{
    std::vector<std::string> datas { { "$GPGLL,5109.0262317,N,11401.8407304,W,202725.00,A,D*79\r\n" },
                                     { "$GNGLL,5109.0262321,N,11401.8407167,W,174738.00,A,D*6B\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GLL::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPHDTTest, bool)
{
    std::vector<std::string> datas { { "$GPHDT,75.5664,T*36\r\n" }, { "$GNHDT,75.5554,T*45\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::HDT::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPRMBTest, bool)
{
    std::vector<std::string> datas { { "$GPRMB,A,4.32,L,FROM,TO,5109.7578000,N,11409.0960000,W,4.6,279.2,0.0,V,D*4A\r\n" },
                                     { "$GNRMB,A,4.32,L,FROM,TO,5109.7578000,N,11409.0960000,W,4.6,279.2,0.0,V,D*54\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::RMB::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPRMCTest, bool)
{
    std::vector<std::string> datas { { "$GPRMC,203522.00,A,5109.0262308,N,11401.8407342,W,0.004,133.4,130522,0.0,E,D*2B\r\n" },
                                     { "$GNRMC,204520.00,A,5109.0262239,N,11401.8407338,W,0.004,102.3,130522,0.0,E,D*3B\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::RMC::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPSCNAVRAWMESSAGETest, bool)
{
    std::vector<std::string> datas { { "#GPSCNAVRAWMESSAGEA,USB1,0,46.5,SATTIME,2209,506256.000,02000020,06c3,16809;269,25,GPSL2C,10,"
                                       "8b64aa4cd1142707f75100a5187ffd0e6341b800a9731a4316f02b1af1c8a36c97f854792390*7e700506\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GPSCNAVRAWMESSAGE::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPSEPHEMTest, bool)
{
    std::vector<std::string> datas {
        { "#GPSEPHEMA,USB1,30,52.5,SATTIME,2209,496800.000,02000020,1214,16809;1,496800.0,0,33,33,2209,2209,504000.0,2.656034748e+07,3."
          "711940331e-09,2.013999822e+00,1.1881368468e-02,9.0331062162e-01,-2.292916179e-06,1.384504139e-05,1.27000000e+02,-4.17500000e+01,"
          "-2.440065145e-07,-1.601874828e-07,9.8797254649e-01,1.546492989e-10,2.868107379e+00,-7.51745599e-09,33,504000.0,5.122274160e-09,"
          "3.63708e-04,-8.29914e-12,0.00000,TRUE,1.458576941e-04,4.00000000e+00*b892b91a\r\n" },
        { "#GPSEPHEMA,USB1,29,52.5,SATTIME,2209,506310.000,02000020,1214,16809;2,506310.0,0,59,59,2209,2209,511200.0,2.656030527e+07,4."
          "114457098e-09,-3.065876369e+00,2.0427562180e-02,-1.419168291e+00,-3.142282367e-06,1.297891140e-05,1.24593750e+02,-6.54062500e+"
          "01,3.781169653e-07,1.844018698e-07,9.6608612461e-01,9.000374902e-11,2.777002903e+00,-7.50781273e-09,59,511200.0,-1.769512892e-"
          "08,-6.53255e-04,1.13687e-13,0.00000,TRUE,1.458584443e-04,4.00000000e+00*613e9e7e\r\n" },
        { "#GPSEPHEMA,USB1,1,52.5,SATTIME,2209,506310.000,02000020,1214,16809;31,506310.0,0,73,73,2209,2209,511200.0,2.656107835e+07,4."
          "222318734e-09,1.928386048e+00,1.0431749630e-02,3.8970372621e-01,2.447515726e-06,1.280941069e-05,1.34125000e+02,4.61250000e+01,-"
          "1.508742571e-07,2.980232239e-08,9.5538846447e-01,-2.110802209e-10,-2.6326210009e-01,-7.85925594e-09,73,511200.0,-1.350417733e-"
          "08,-1.77489e-04,-1.59162e-12,0.00000,TRUE,1.458521844e-04,4.00000000e+00*085ac00a\r\n" },
        { "#GPSEPHEMA,USB1,0,52.5,SATTIME,2209,497010.000,02000020,1214,16809;32,497010.0,0,49,49,2209,2209,504000.0,2.655950009e+07,4."
          "804485840e-09,-1.401126814e+00,5.9581462992e-03,-2.285950321e+00,-2.717599273e-06,6.832182407e-06,2.48281250e+02,-5.08437500e+"
          "01,1.899898052e-07,1.490116119e-08,9.5774991123e-01,-5.596661695e-10,-1.341873629e+00,-8.19927010e-09,49,504000.0,4.656612873e-"
          "10,-1.26368e-04,-8.64020e-12,0.00000,TRUE,1.458657670e-04,4.00000000e+00*82ba7dc8\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::GPSEPHEM::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPVTGTest, bool)
{
    std::vector<std::string> datas { { "$GPVTG,224.592,T,224.592,M,0.003,N,0.005,K,D*20\r\n" },
                                     { "$GNVTG,139.969,T,139.969,M,0.007,N,0.013,K,D*3D\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::VTG::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(GPZDATest, bool)
{
    std::vector<std::string> datas { { "$GPZDA,204007.00,13,05,2022,,*62\r\n" }, { "$GPZDA,010708.00,05,04,2007,00,00*6C\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::ZDA::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(ALIGNBSLNENUTest, bool)
{
    std::vector<std::string> datas {
        { "#ALIGNBSLNENUA,COM1,0,29.0,FINESTEERING,1629,259250.000,02040000,100b,39448;SOL_COMPUTED,NARROW_INT,4.1586,-1.9197,-0.0037,0."
          "0047,0.0050,0.0062,\"0092\",\"AAAA\",22,16,16,16,0,01,0,33*11e1d4c0\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::ALIGNBSLNENU::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(ALIGNBSLNXYZTest, bool)
{
    std::vector<std::string> datas {
        { "#ALIGNBSLNXYZA,COM1,0,29.0,FINESTEERING,1629,259250.000,02040000,9d28,39448;SOL_COMPUTED,NARROW_INT,3.1901,-3.0566,1.2079,0."
          "0050,0.0054,0.0056,\"0092\",\"AAAA\",22,16,16,16,0,01,0,33*ac372198\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::ALIGNBSLNXYZ::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(ALIGNDOPTest, bool)
{
    std::vector<std::string> datas { { "#ALIGNDOPA,COM1,0,22.5,FINESTEERING,1629,259250.000,02040000,de2d,39448;1.6160,1.2400,0.6900,0."
                                       "9920,0.7130,10.0,16,4,32,23,10,7,20,13,30,16,47,43,46,53,54,44,45*90a72971\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::ALIGNDOP::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(ALMANACTest, bool)
{
    std::vector<std::string> datas {
        { "#ALMANACA,USB1,0,65.5,SATTIME,2209,494970.000,02000020,06de,16809;31,1,2210,61440.0,1.189947e-02,-7.49745516e-09,2.7464570e+00,"
          "9.04911221e-01,5.43628036e-01,3.62396240e-04,-7.27595761e-12,1.45857660e-04,2.6559901e+07,4.54861256e-02,3,0,0,TRUE,2,2210,"
          "61440.0,2.042484e-02,-7.79461039e-09,2.6553604e+00,-1.4191382e+00,6.98451114e-01,-6.53266907e-04,0.00000000,1.45858448e-04,2."
          "6559805e+07,2.35789625e-02,1,0,0,TRUE,3,2210,61440.0,4.142284e-03,-7.64603277e-09,-2.5031848e+00,9.52756366e-01,-5.65670396e-01,"
          "-2.45094299e-04,-1.45519152e-11,1.45862179e-04,2.6559352e+07,3.12788270e-02,3,0,0,TRUE,30,2210,61440.0,5.815029e-03,-7."
          "89747182e-09,-3.91536612e-01,-2.6938085e+00,-1.35149100e-01,-5.28335571e-04,0.00000000,1.45850074e-04,2.6560822e+07,-6."
          "21981273e-03,3,0,0,TRUE,31,2210,61440.0,1.043320e-02,-7.71460706e-09,-3.84896228e-01,3.90039333e-01,-5.91707997e-01,-1."
          "77383423e-04,0.00000000,1.45852520e-04,2.6560525e+07,1.28291128e-02,2,0,0,TRUE,32,2210,61440.0,5.961895e-03,-8.08033658e-09,-1."
          "4636431e+00,-2.2868654e+00,-2.8675969e+00,-1.27792358e-04,-7.27595761e-12,1.45866076e-04,2.6558879e+07,1.52259577e-02,3,0,0,"
          "TRUE*0eadcab6\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::ALMANAC::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(BESTPOSTest, bool)
{
    std::vector<std::string> datas { { "#BESTPOSA,USB1,0,58.5,FINESTEERING,2209,502061.000,02000020,cdba,16809;SOL_COMPUTED,PPP,51."
                                       "15043706870,-114.03067882331,1097.3462,-17.0001,WGS84,0.0154,0.0139,0.0288,\"TSTR\",11.000,0.000,"
                                       "43,39,39,38,00,00,7f,37*52483ac5\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::BESTPOS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(PSRPOSTest, bool)
{
    std::vector<std::string> datas {
        { "#PSRPOSA,USB1,0,20.0,FINESTEERING,2209,511779.000,02000020,28ff,16809;SOL_COMPUTED,WAAS,51.15043801969,-114.03066782703,1096."
          "7864,-17.0000,WGS84,0.9069,0.8826,1.8779,\"133\",4.000,0.000,45,10,0,0,00,06,00,03*bc4f3b04\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::PSRPOS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(TIMETest, bool)
{
    std::vector<std::string> datas { { "#TIMEA,USB1,0,50.5,FINESTEERING,2209,515163.000,02000020,9924,16809;VALID,-2.501488425e-09,6."
                                       "133312031e-10,-17.99999999630,2022,5,13,23,5,45000,VALID*1100ad64\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::TIME::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(RTKDOPTest, bool)
{
    std::vector<std::string> datas { { "#RTKDOPA,USB1,0,66.5,FINESTEERING,2211,234163.000,02000020,b42b,16809;1.3390,1.0580,0.6760,0.8610,"
                                       "0.5340,5.0,16,17,3,6,12,19,2,24,14,1,46,57,38,47,45,55,56*6757f996\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::RTKDOP::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(SBAS25Test, bool)
{
    std::vector<std::string> datas { { "#SBAS25A,USB1,0,51.5,SATTIME,2209,514661.000,02000020,b8ff,16809;133,1,16,94,23,-11,1,-3,0,0,-1,-1,"
                                       "1,-6,5157,2,0,1,31,75,0,12,1,12,0,0,-1,-1,1,0,5157,2,0*3341fe84\r\n" } };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::SBAS25::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(BESTSATSTest, bool)
{
    std::vector<std::string> datas {
        { "#BESTSATSA,USB1,0,70.5,FINESTEERING,2306,263137.000,02088000,be05,17139;7,BEIDOU,59,GOOD,00000001,"
          "BEIDOU,62,GOOD,00000001,BEIDOU,39,GOOD,00000001,BEIDOU,9,GOOD,00000001,BEIDOU,61,GOOD,00000001,"
          "BEIDOU,30,GOOD,00000001,BEIDOU,19,GOOD,00000001*9e1eafd7\r\n " },
        { "#BESTSATSA,USB1,0,74.0,FINESTEERING,2306,263138.000,02088000,be05,17139;10,BEIDOU,57,GOOD,00000001,BEIDOU,60,GOOD,00000001,"
          "BEIDOU,59,GOOD,00000001,BEIDOU,62,GOOD,00000001,BEIDOU,39,GOOD,00000001,BEIDOU,9,GOOD,00000001,BEIDOU,61,GOOD,00000001,BEIDOU,"
          "36,GOOD,00000001,BEIDOU,30,GOOD,00000001,BEIDOU,19,GOOD,00000001*b6315bbc\r\n" },
        { "#BESTSATSA,USB1,0,77.0,FINESTEERING,2306,263139.000,02088000,be05,17139;10,BEIDOU,57,NOTUSED,00000000,BEIDOU,60,NOTUSED,"
          "00000000,BEIDOU,59,NOTUSED,00000000,BEIDOU,62,NOTUSED,00000000,BEIDOU,39,NOTUSED,00000000,BEIDOU,9,NOTUSED,00000000,BEIDOU,61,"
          "NOTUSED,00000000,BEIDOU,36,NOTUSED,00000000,BEIDOU,30,NOTUSED,00000000,BEIDOU,19,NOTUSED,00000000*efd82873\r\n" },
        { "#BESTSATSA,USB1,0,74.0,FINESTEERING,2306,263140.000,02088000,be05,17139;14,BEIDOU,57,NOTUSED,00000000,BEIDOU,60,NOTUSED,"
          "00000000,BEIDOU,59,NOTUSED,00000000,BEIDOU,1,NOTUSED,00000000,BEIDOU,62,NOTUSED,00000000,BEIDOU,4,NOTUSED,00000000,BEIDOU,39,"
          "NOTUSED,00000000,BEIDOU,9,NOTUSED,00000000,BEIDOU,61,NOTUSED,00000000,BEIDOU,36,NOTUSED,00000000,BEIDOU,30,NOTUSED,00000000,"
          "BEIDOU,46,NOTUSED,00000000,BEIDOU,19,NOTUSED,00000000,BEIDOU,21,NOTUSED,00000000*3c72ae53\r\n" },
        { "#BESTSATSA,USB1,0,74.0,FINESTEERING,2306,263141.000,02088000,be05,17139;15,BEIDOU,57,NOTUSED,00000000,BEIDOU,60,NOTUSED,"
          "00000000,BEIDOU,59,NOTUSED,00000000,BEIDOU,1,NOTUSED,00000000,BEIDOU,62,NOTUSED,00000000,BEIDOU,4,NOTUSED,00000000,BEIDOU,39,"
          "NOTUSED,00000000,BEIDOU,9,NOTUSED,00000000,BEIDOU,7,NOTUSED,00000000,BEIDOU,61,NOTUSED,00000000,BEIDOU,36,NOTUSED,00000000,"
          "BEIDOU,30,NOTUSED,00000000,BEIDOU,46,NOTUSED,00000000,BEIDOU,19,NOTUSED,00000000,BEIDOU,21,NOTUSED,00000000*d0e4d12c\r\n" },
        { "#BESTSATSA,USB1,0,71.5,FINESTEERING,2306,263142.000,02088000,be05,17139;16,BEIDOU,57,NOTUSED,00000000,BEIDOU,60,NOTUSED,"
          "00000000,BEIDOU,59,NOTUSED,00000000,BEIDOU,1,NOTUSED,00000000,BEIDOU,62,NOTUSED,00000000,BEIDOU,4,NOTUSED,00000000,BEIDOU,39,"
          "NOTUSED,00000000,BEIDOU,16,NOTUSED,00000000,BEIDOU,9,NOTUSED,00000000,BEIDOU,7,NOTUSED,00000000,BEIDOU,61,NOTUSED,00000000,"
          "BEIDOU,36,NOTUSED,00000000,BEIDOU,30,NOTUSED,00000000,BEIDOU,46,NOTUSED,00000000,BEIDOU,19,NOTUSED,00000000,BEIDOU,21,NOTUSED,"
          "00000000*a573e095\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::BESTSATS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
        {
            std::print("{}", *ret);
            // for (const auto& sat : ret->sats)
            //{
            //     std::visit(
            //         [](const auto& val)
            //         {
            //             if constexpr (std::same_as<std::decay_t<decltype(val)>, std::monostate>)
            //                 std::print("None");
            //             else
            //                 std::print("signal mask: {}", val);
            //         },
            //         sat.getSignalMasks());
            // }
        }
        printSplit();
    }
}

TEST(SATXYZ2Test, bool)
{
    std::vector<std::string> datas {
        { "#SATXYZ2A,USB1,0,62.0,FINESTEERING,2306,263087.000,02008000,7513,17139;27,GPS,4,45097.6659,23664894.6586,11942314.6715,1.321,1."
          "545,2.612,0.0,0.0,BEIDOU,27,-20678997.3112,2356435.2899,18561130.7029,0.108,3.567,6.599,0.0,0.0,BEIDOU,19,376746.8798,26344124."
          "3800,-9213298.9997,0.735,2.854,5.606,0.0,0.0,BEIDOU,3,-14710642.6208,39497334.9161,-1023005.7550,0.808,1.851,3.164,0.0,0.0,"
          "BEIDOU,4,-39609011.4255,14401338.8203,-1148456.1463,-0.446,3.744,7.366,0.0,0.0,BEIDOU,5,21963331.2184,35972414.8227,-211897."
          "1460,0.818,2.679,5.065,0.0,0.0,BEIDOU,7,-7959915.6226,39952771.2388,11359323.6171,-0.315,1.556,2.625,0.0,0.0,BEIDOU,61,-"
          "14698427.6801,39484676.2619,-462547.9637,0.251,1.832,3.129,0.0,0.0,BEIDOU,46,-20790224.5388,6480424.3054,17461717.2537,-0.536,2."
          "912,4.905,0.0,0.0,BEIDOU,21,16234517.3975,7288054.5670,21523646.6759,-0.235,3.505,8.593,0.0,0.0,BEIDOU,9,-9564805.6109,26761406."
          "9241,31384773.5823,9.757,1.602,2.674,0.0,0.0,BEIDOU,6,-16931868.3055,27732527.4868,26772369.0473,3.109,1.608,2.654,0.0,0.0,"
          "BEIDOU,1,-34352855.6932,24413635.4349,-1262495.4517,-0.291,2.730,4.664,0.0,0.0,BEIDOU,2,4458994.5328,41934367.5597,-487906.8415,"
          "0.906,1.950,3.384,0.0,0.0,BEIDOU,31,694813.5185,41837539.3498,-3501502.1560,0.163,2.002,3.483,0.0,0.0,BEIDOU,30,-21302914.5408,"
          "17409030.5931,4580688.2773,0.136,2.365,3.908,0.0,0.0,BEIDOU,39,-25358493.2657,27826680.6144,18818886.8214,2.279,1.743,2.868,0.0,"
          "0.0,BEIDOU,10,-2115808.1181,42176936.9363,4803769.7740,-4.101,1.692,2.903,0.0,0.0,BEIDOU,22,11787941.3157,23716466.4071,8845706."
          "2919,-0.111,2.135,3.749,0.0,0.0,BEIDOU,36,-3272732.8477,15604929.3033,22918095.3435,-0.143,1.730,2.929,0.0,0.0,BEIDOU,29,-"
          "9287062.5200,22610289.7810,-13464466.7183,0.165,3.449,8.246,0.0,0.0,BEIDOU,59,-32276872.8217,27115972.4836,-945334.9715,0.202,2."
          "504,4.219,0.0,0.0,BEIDOU,62,-39573993.1288,14483199.9982,1572528.7368,0.189,3.539,6.619,0.0,0.0,BEIDOU,45,16723276.4091,"
          "15995970.2203,15571118.4693,-0.104,2.756,5.292,0.0,0.0,BEIDOU,60,7296274.1816,41496337.4042,-1498341.5403,0.112,2.060,3.597,0.0,"
          "0.0,BEIDOU,57,1027920.6947,27882153.3638,813681.4948,0.271,1.919,3.326,0.0,0.0,BEIDOU,16,-21147332.8719,27244636.9705,24293294."
          "7581,6.137,1.660,2.735,0.0,0.0*242b9870\r\n" },
        { "#SATXYZ2A,USB1,0,61.5,FINESTEERING,2306,263088.000,02008000,7513,17139;27,GPS,4,44348.4053,23666235.4511,11939643.6117,1.321,1."
          "545,2.612,0.0,0.0,BEIDOU,27,-20677489.3794,2354939.1451,18562999.5495,0.108,3.567,6.599,0.0,0.0,BEIDOU,19,376471.7459,26343105."
          "9893,-9216209.7207,0.735,2.854,5.607,0.0,0.0,BEIDOU,3,-14710642.2447,39497330.6649,-1023056.8568,0.808,1.851,3.164,0.0,0.0,"
          "BEIDOU,4,-39609014.0654,14401338.1359,-1148431.8900,-0.446,3.744,7.366,0.0,0.0,BEIDOU,5,21963328.6211,35972412.4189,-211995."
          "5797,0.818,2.679,5.065,0.0,0.0,BEIDOU,7,-7958888.2824,39952351.6300,11361523.2378,-0.315,1.556,2.625,0.0,0.0,BEIDOU,61,-"
          "14698431.6848,39484673.8540,-462545.0214,0.251,1.832,3.129,0.0,0.0,BEIDOU,46,-20792121.3675,6479803.5396,17459693.6052,-0.536,2."
          "912,4.905,0.0,0.0,BEIDOU,21,16235096.3395,7290436.7156,21522404.8471,-0.235,3.505,8.592,0.0,0.0,BEIDOU,9,-9565685.1290,26762369."
          "5624,31383638.0615,9.758,1.602,2.674,0.0,0.0,BEIDOU,6,-16932469.1964,27733699.5621,26770757.4203,3.109,1.608,2.654,0.0,0.0,"
          "BEIDOU,1,-34352857.2534,24413634.5971,-1262503.7654,-0.291,2.730,4.664,0.0,0.0,BEIDOU,2,4458997.4675,41934362.6155,-488026.5772,"
          "0.906,1.950,3.384,0.0,0.0,BEIDOU,31,696076.3733,41837307.6269,-3504012.2079,0.162,2.002,3.483,0.0,0.0,BEIDOU,30,-21302609.2340,"
          "17408595.4031,4583756.5907,0.136,2.365,3.907,0.0,0.0,BEIDOU,39,-25358600.8201,27828032.2836,18816724.9112,2.279,1.743,2.868,0.0,"
          "0.0,BEIDOU,10,-2114685.0148,42176743.8405,4806087.0851,-4.101,1.692,2.903,0.0,0.0,BEIDOU,22,11788160.9254,23717450.6632,8842776."
          "0648,-0.111,2.135,3.749,0.0,0.0,BEIDOU,36,-3275248.8115,15604217.8100,22918221.3013,-0.143,1.730,2.929,0.0,0.0,BEIDOU,29,-"
          "9288183.7172,22611342.5119,-13461923.4048,0.165,3.448,8.243,0.0,0.0,BEIDOU,59,-32276870.5431,27115971.2454,-945416.2616,0.202,2."
          "504,4.219,0.0,0.0,BEIDOU,62,-39573991.0006,14483198.4043,1572578.9297,0.189,3.539,6.619,0.0,0.0,BEIDOU,45,16721543.5731,"
          "15995552.6227,15573409.2453,-0.104,2.755,5.292,0.0,0.0,BEIDOU,60,7296271.4242,41496335.8886,-1498385.7016,0.112,2.060,3.597,0.0,"
          "0.0,BEIDOU,57,1027896.5071,27882244.9699,810516.8473,0.271,1.919,3.326,0.0,0.0,BEIDOU,16,-21147782.3148,27245906.5369,24291441."
          "7401,6.137,1.660,2.735,0.0,0.0*48eb1529\r\n" },
        { "#SATXYZ2A,USB1,0,61.0,FINESTEERING,2306,263089.000,02008000,7513,17139;27,GPS,4,43599.3394,23667575.9722,11936972.2965,1.320,1."
          "545,2.612,0.0,0.0,BEIDOU,27,-20675981.3959,2353442.7497,18564868.0549,0.108,3.567,6.600,0.0,0.0,BEIDOU,19,376196.4585,26342087."
          "2960,-9219120.2728,0.735,2.855,5.608,0.0,0.0,BEIDOU,3,-14710641.8691,39497326.4135,-1023107.9532,0.808,1.851,3.164,0.0,0.0,"
          "BEIDOU,4,-39609016.7052,14401337.4520,-1148407.6275,-0.446,3.744,7.366,0.0,0.0,BEIDOU,5,21963326.0233,35972410.0152,-212094."
          "0121,0.818,2.679,5.065,0.0,0.0,BEIDOU,7,-7957861.0037,39951931.8733,11363722.7986,-0.314,1.556,2.625,0.0,0.0,BEIDOU,61,-"
          "14698435.6896,39484671.4463,-462542.0766,0.251,1.832,3.129,0.0,0.0,BEIDOU,46,-20794018.0163,6479182.9661,17457669.6368,-0.536,2."
          "913,4.906,0.0,0.0,BEIDOU,21,16235675.4183,7292818.6851,21521162.6246,-0.234,3.505,8.590,0.0,0.0,BEIDOU,9,-9566564.5073,26763332."
          "3307,31382502.3759,9.758,1.603,2.674,0.0,0.0,BEIDOU,6,-16933069.9161,27734871.7243,26769145.6503,3.109,1.608,2.654,0.0,0.0,"
          "BEIDOU,1,-34352858.8138,24413633.7595,-1262512.0724,-0.291,2.730,4.664,0.0,0.0,BEIDOU,2,4459000.4015,41934357.6710,-488146.3103,"
          "0.906,1.950,3.384,0.0,0.0,BEIDOU,31,697339.1941,41837075.7170,-3506522.2410,0.162,2.002,3.484,0.0,0.0,BEIDOU,30,-21302303.7126,"
          "17408159.9412,4586824.8200,0.136,2.365,3.907,0.0,0.0,BEIDOU,39,-25358708.1766,27829383.9678,18814562.9004,2.279,1.743,2.868,0.0,"
          "0.0,BEIDOU,10,-2113561.9399,42176550.5863,4808404.3714,-4.100,1.691,2.903,0.0,0.0,BEIDOU,22,11788380.5254,23718434.5792,8839845."
          "6758,-0.111,2.135,3.749,0.0,0.0,BEIDOU,36,-3277764.8365,15603506.4809,22918346.8393,-0.143,1.730,2.929,0.0,0.0,BEIDOU,29,-"
          "9289304.6400,22612395.1119,-13459379.8444,0.165,3.448,8.240,0.0,0.0,BEIDOU,59,-32276868.2647,27115970.0069,-945497.5467,0.202,2."
          "504,4.219,0.0,0.0,BEIDOU,62,-39573988.8727,14483196.8101,1572629.1142,0.189,3.539,6.619,0.0,0.0,BEIDOU,45,16719810.4579,"
          "15995135.0692,15575699.7353,-0.104,2.755,5.291,0.0,0.0,BEIDOU,60,7296268.6665,41496334.3734,-1498429.8550,0.112,2.060,3.597,0.0,"
          "0.0,BEIDOU,57,1027872.3195,27882336.2168,807352.1850,0.271,1.920,3.326,0.0,0.0,BEIDOU,16,-21148231.5727,27247176.1690,24289588."
          "5930,6.137,1.660,2.735,0.0,0.0*95ceeb3f\r\n" },
        { "#SATXYZ2A,USB1,0,61.0,FINESTEERING,2306,263090.000,02008000,7513,17139;27,GPS,4,42850.4684,23668916.2220,11934300.7258,1.320,1."
          "545,2.612,0.0,0.0,BEIDOU,27,-20674473.3605,2351946.1036,18566736.2192,0.108,3.568,6.600,0.0,0.0,BEIDOU,19,375921.0177,26341068."
          "3001,-9222030.6559,0.735,2.855,5.610,0.0,0.0,BEIDOU,3,-14710641.4941,39497322.1620,-1023159.0441,0.808,1.851,3.164,0.0,0.0,"
          "BEIDOU,4,-39609019.3452,14401336.7684,-1148383.3590,-0.446,3.745,7.366,0.0,0.0,BEIDOU,5,21963323.4250,35972407.6116,-212192."
          "4435,0.818,2.679,5.065,0.0,0.0,BEIDOU,7,-7956833.7866,39951511.9687,11365922.2995,-0.314,1.556,2.625,0.0,0.0,BEIDOU,61,-"
          "14698439.6946,39484669.0387,-462539.1293,0.251,1.832,3.129,0.0,0.0,BEIDOU,46,-20795914.4850,6478562.5849,17455645.3484,-0.536,2."
          "913,4.906,0.0,0.0,BEIDOU,21,16236254.6337,7295200.4754,21519920.0081,-0.234,3.504,8.589,0.0,0.0,BEIDOU,9,-9567443.7458,26764295."
          "2291,31381366.5254,9.758,1.603,2.673,0.0,0.0,BEIDOU,6,-16933670.4643,27736043.9735,26767533.7374,3.109,1.608,2.653,0.0,0.0,"
          "BEIDOU,1,-34352860.3742,24413632.9221,-1262520.3727,-0.291,2.731,4.664,0.0,0.0,BEIDOU,2,4459003.3348,41934352.7262,-488266.0408,"
          "0.906,1.950,3.384,0.0,0.0,BEIDOU,31,698601.9812,41836843.6202,-3509032.2552,0.162,2.002,3.484,0.0,0.0,BEIDOU,30,-21301997.9766,"
          "17407724.2075,4589892.9649,0.135,2.365,3.906,0.0,0.0,BEIDOU,39,-25358815.3352,27830735.6667,18812400.7890,2.279,1.743,2.868,0.0,"
          "0.0,BEIDOU,10,-2112438.8936,42176357.1735,4810721.6326,-4.100,1.691,2.903,0.0,0.0,BEIDOU,22,11788600.1158,23719418.1550,8836915."
          "1249,-0.111,2.135,3.749,0.0,0.0,BEIDOU,36,-3280280.9226,15602795.3159,22918471.9576,-0.143,1.730,2.929,0.0,0.0,BEIDOU,29,-"
          "9290425.2882,22613447.5809,-13456836.0372,0.165,3.447,8.238,0.0,0.0,BEIDOU,59,-32276865.9865,27115968.7680,-945578.8267,0.202,2."
          "504,4.219,0.0,0.0,BEIDOU,62,-39573986.7451,14483195.2157,1572679.2903,0.189,3.539,6.619,0.0,0.0,BEIDOU,45,16718077.0636,"
          "15994717.5597,15577989.9391,-0.104,2.755,5.291,0.0,0.0,BEIDOU,60,7296265.9086,41496332.8585,-1498474.0004,0.112,2.060,3.597,0.0,"
          "0.0,BEIDOU,57,1027848.1318,27882427.1045,804187.5079,0.272,1.920,3.327,0.0,0.0,BEIDOU,16,-21148680.6456,27248445.8668,24287735."
          "3170,6.137,1.660,2.735,0.0,0.0*e64eb6bc\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::SATXYZ2::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(BDSEPHEMERISTest, bool)
{
    std::vector<std::string> datas {
        { "#BDSEPHEMERISA,USB1,37,62.0,SATTIME,2209,496784.000,02000020,2626,16809;6,853,2.00,0,8.30e-09,-1.60e-09,0,493200,-2.22835224e-"
          "05,7.54090124e-11,0.00000000,1,493200,6493.813231,2.7420885162e-03,-2.990457924,7.3681640565e-10,-2.306284799,-8.5916965356e-01,"
          "-1.83364781e-09,9.4558331017e-01,-1.049329423e-09,-5.817040801e-06,2.914015204e-05,-660.2187500,-168.3906250,1.862645149e-08,-1."
          "862645149e-09*7a36ae90\r\n" },
        { "#BDSEPHEMERISA,USB1,36,62.0,SATTIME,2209,446414.000,02000020,2626,16809;7,853,2.00,0,1.42e-08,7.00e-10,0,446400,-1.59412972e-04,"
          "-4.91571228e-11,0.00000000,1,446400,6493.661501,2.0398380002e-03,3.127789902,2.1922341725e-09,-1.234405677,1.121228087e+00,-3."
          "13084470e-09,8.7727285371e-01,1.428630937e-11,4.341825843e-06,-1.132534817e-05,564.6718750,139.0781250,5.261972547e-08,-2."
          "561137080e-08*f39a85dd\r\n" }
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::BDSEPHEMERIS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(AUTHCODESTest, bool)
{
    std::vector<std::string> datas {
        { "#AUTHCODESA,USB1,0,67.0,FINESTEERING,2209,495534.000,02000020,2ad2,16809;VALID,1,STANDARD,TRUE,\"KGHNCD,6ZD36P,GXBTC5,34M5DR,"
          "CW573K,FFNRNNCBES1\"*02d3c863\r\n" },
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::AUTHCODES::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(AVEPOSTest, bool)
{
    std::vector<std::string> datas {
        { "#AVEPOSA,USB1,0,72.5,FINESTEERING,2210,147873.000,02100020,e3b4,16809;51.15043181793,-114.03067226763,1097.6045,1.9300,1.9294,1."
          "9392,COMPLETE,5,6*83bdc6a3\r\n" },
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::AVEPOS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(BESTVELTest, bool)
{
    std::vector<std::string> datas {
        { "#BESTVELA,USB1,0,57.5,FINESTEERING,2209,502223.000,02000020,10a2,16809;SOL_COMPUTED,PPP,0.250,13.000,0.0025,28.358727,0.0021,0*"
          "e9418656\r\n" },
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::BESTVEL::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(PSRDOP2Test, bool)
{
    std::vector<std::string> datas {
        { "#PSRDOP2A,USB1,0,18.5,FINESTEERING,2209,511740.000,02000020,0802,16809;1.8150,1.6190,0.8940,1.3490,1,GPS,0.8220*2a32bc78\r\n" },
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::PSRDOP2::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

TEST(RAIMSTATUSTest, bool)
{
    std::vector<std::string> datas {
        { "#RAIMSTATUSA,USB1,0,54.0,FINESTEERING,2209,512358.000,02000020,bf2d,16809;DEFAULT,PASS,NOT_AVAILABLE,0.000,NOT_AVAILABLE,0.000,"
          "0*3f408598\r\n" },
    };
    GnssLogs::Decoder decoder;
    for (const auto& data : datas)
    {
        auto ret = decoder.decode<GnssLogs::RAIMSTATUS::Data>(data);
        EXPECT_TRUE(ret);
        if (ret)
            std::print("{}", *ret);
        printSplit();
    }
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}